
<style lang="scss" scoped>
.content {
  padding-top: 60px;
  position: fixed;
  width: 100%;
  height: 100%;
  .scoll {
    height: calc(100% - 180px);
    overflow: auto;
  }
  .navbar {
    width: 100%;
    height: 40px;
    font-size: 14px;
    background-color: #fff;
    border-top: 1px solid #dadada;
    border-bottom: 1px solid #dadada;
    padding-left: 20px;
    .left {
      width: 390px;
      height: 40px;
      float: left;
      padding-right: 10px;
      border-right: 1px solid #dadada;
      padding-left: 4px;
      .nav {
        height: 30px;
        margin: 0 auto;
        margin-top: 4px;
        border-radius: 15px;
        background-color: #f0efef;
        .z,
        .g {
          display: inline-block;
          width: 48.9%;
          height: 25px;
          margin-top: 2px;
          line-height: 25px;
          text-align: center;
          border-radius: 17.5px;
          color: #a1a1a1;
          cursor: pointer;
        }
        // .g {
        //   width: 130px;
        // }
        .active {
          color: #fff;
          margin: 0 4px;
          background-color: #4591ff;
        }
        .theKeyActive {
          color: #fff;
          margin: 0 4px;
          background-color: #5ABD0A;
        }
      }
    }
    .submittip{
        color: red;
        float: right;
        height: 100%;
        line-height: 40px;
        margin-right: 1%;
      }
    .submit {
      float: right;
      font-size: 14px;
      height: 40px;
      line-height: 36px;
      margin-right: 2%;
      .t {
        display: inline-block;
        position: relative;
        right: 30px;
        top: 8px;
        width: 58px;
        height: 24px;
        line-height: 24px;
        text-align: center;
        border-radius: 12px;
        background-color: #4591ff;
        color: #fff;
        cursor: pointer;
      }
    }
  }
  .center {
    max-width: 1366px;
    margin: 0 auto;
  }
  .section {
    max-width: 1366px;
    margin: 0 auto;
    font-size: 12px;
    padding-top: 15px;
    .left {
      width: 390px;
      // background: red;
      float: left;
      margin-left: 20px;
      position: relative;
    }
    .right {
      margin-right: 20px;
    }
  }
  .detailed{
    position: fixed;
    right: 0;
    bottom: 10%;
    img{
      width: 76px;
      cursor: pointer;
    }
  }
}
.myimport {
  .el-dialog {
    width: 736px !important;
    height: 360px;
    .el-dialog__header {
      height: 45px;
      padding: 15px 15px 0 30px;
      .el-dialog__title {
        position: relative;
        font-size: 14px;
        font-weight: 600;
        line-height: 7px;
        &::before {
          content: "";
          position: absolute;
          top: 1px;
          left: -10px;
          display: block;
          width: 3px;
          height: 14px;
          background-color: #4b92f7;
        }
      }
      .el-dialog__headerbtn {
        top: 12px;
      }
    }
  }
  .el-dialog__body {
    padding: 0;
    .main {
      width: 694px;
      margin: 0 auto;
      border-top: 1px solid #d4d4d4;
      padding-top: 22px;
      .steps {
        width: 665px;
        height: 45px;
        margin: 0 auto;
        // background: rgb(233, 203, 203);
        .one {
          float: left;
          width: 255px;
          .yuan {
            float: left;
            width: 27px;
            height: 27px;
            line-height: 27px;
            text-align: center;
            border-radius: 50%;
            border: 1px solid #999;
          }
          .yuanActive{
            border: 1px solid #448EF7;
            background: #448EF7;
            color: #fff;
          }
          .title {
            position: relative;
            float: left;
            margin: 0 16px 0 11px;
            font-size: 13px;
            line-height: 30px;
            .info {
              float: left;
              position: absolute;
              top: 22px;
              left: 0;
              width: 150px;
              font-size: 12px;
              overflow: hidden;
              white-space: nowrap;
              text-overflow: ellipsis;
              color: rgb(170, 169, 169);
            }
          }
          .xian {
            float: left;
            width: 135px;
            height: 2.5px;
            background-color: #999;
            margin-top: 14px;
          }
          .xianActive{
            background-color: #448EF7;
          }
        }
        .last {
          float: left;
          width: 150px;
        }
      }
      .displayshow {
        width: 100%;
        height: 115px;
        margin: 26px 0;
        overflow: hidden;
        .displayshowimg{
          width: 100%;
          text-align: center;
          margin-top: 10px;
          img{
            width: 60px;
          }
          .importimg{
            width: 120px;
          }
        }
        .displayshowbtn{
          text-align: center;
          margin-top: 10px;
          .sucessContent{
            width: 80%;
            display: block;
            background: #F8F8F8;
            margin: 0 auto;
            height: 30px;
            line-height: 30px;
            text-align: left;
            padding: 0 2%;
            span{
              float: right;
              cursor: pointer;
              width: 20px;
              text-align: center;
            }
          }
        }
        .importend{
          color: #448EF7;
        }
      }
      .tipsTitle{
        width: 100%;
        text-align: left;
        color: #CF352E;
        height: 30px;
        font-family: PingFang SC;
      }
      .footer {
        width: 100%;
        text-align: right;
      }
    }
  }
}
</style>
<template>
  <div class="content">
    <bxHeader @date="date" />
    <bxTitle />
    <!-- <bxTab /> -->
    <div class="scoll">
      <titleInfo :date="year" :steps="false" :tab-content="tabContent" />
      <div class="navbar">
        <div class="center">
          <div class="left">
            <div class="nav">
              <span class="z" :class="importantActive === true ? 'active' : ''" @click="theKeyClick('0')">重要任务</span>
              <span class="g" :class="importantActive === false ? 'theKeyActive' : ''" @click="theKeyClick('1')">关键指标</span>
            </div>
          </div>
          <div class="submit">
            <el-button
              type="warning"
              style="background: #FE7F39;border:none"
              round
              :disabled="loading"
              @click="saveChangeAxios()"
            >保存点评</el-button>
            <el-button
              type="warning"
              style="background: #50D776;border:none"
              round
              :disabled="loading"
              @click="readAll()"
            >全部阅知</el-button>
            <el-button
              type="primary"
              round
              :disabled="loading"
              @click="feedback()"
            >反馈持表人</el-button>
          </div>
        </div>
      </div>
      <div ref="pinglun" class="section">
        <div v-loading="loading" class="left">
          <bxAsside ref="left" :tab-content="tabContent" :important-active="importantActive" />
        </div>
        <div class="right">
          <bxRight ref="right" v-loading="loading" :tab-content="tabContent" :right-obj="rightObj" :mainactive="!importantActive" />
        </div>
      </div>
    </div>
    <bxFooter />
    <!-- <div class="detailed">
      <img src="../../assets/img/jane.png" alt="" @click="gotoPage()">
    </div> -->
    <!-- <sortTool /> -->
  </div>
</template>
<script>
import bxHeader from '@/components/headerFooter/header'
// import bxTab from '@/components/tab/index'
import bxTitle from '@/components/tab/auditTitle.vue'
import titleInfo from '@/components/tab/titleInfo'
import bxAsside from '@/components/quarterReview/bxAsside.vue'
// import sortTool from '@/components/tab/sortTool.vue'
import bxFooter from '@/components/headerFooter/footer'
import bxRight from '@/components/quarterReview/bxSeeRight.vue'
export default {
  components: {
    bxFooter,
    bxHeader,
    // bxTab,
    bxTitle,
    titleInfo,
    bxRight,
    bxAsside
    // sortTool
  },
  data() {
    return {
      input: '',
      dialogVisible: false,
      previousBtn: false,
      mainActive: '1',
      loading: false,
      importantActive: true,
      year: '',
      missionList: [],
      indexList: [],
      tabContent: {},
      reportHistoryId: '',
      rightObj: {},
      reportId: '',
      quarterNumber: ''
    }
  },
  // watch: {
  //   importantActive(val) {}
  // },
  mounted() {

    // this.init()
  },
  methods: {
    // 滚动条
    scrollTopTimer() {
      this.$refs['pinglun'].scrollIntoView(true)
    },
    // 年份
    date(val) {
      this.year = val
      if (this.$route.query.reportId) {
        this.reportId = this.$route.query.reportId
      }
      if (this.$route.query.quarterNumber) {
        this.quarterNumber = this.$route.query.quarterNumber
      }
      this.init()
    },
    init() {
      this.loading = true
      this.$http.post('/serviceAction/common', {
        'serviceName': 'MT01107',
        'methodName': 'getReportList',
        'reportId': this.reportId,
        'quarterNumber': this.quarterNumber
      }).then((res) => {
        console.log(res)
        if (res.isSuccess) {
          this.loading = false
          this.tabContent = res.data
          this.missionList = res.data.missionList
          this.indexList = res.data.indexList
          this.reportId = res.data.reportId
          this.$refs.left.mainClick(this.missionList[0], 0)
        }
      })
    },
    gotoPage() {
      this.$router.push({
        path: '/checkSubordinatesview'
      })
    },
    getPrintData() {
      return this.$refs.right.getSelfData()
    },
    // loading状态改变
    loadingState(is) {
      this.loading = is
    },
    // 关键指标/重要任务
    theKeyClick(val) {
      if (val === '1') {
        this.importantActive = false
        this.$refs.left.mainClick(this.indexList[0], 0, true)
      } else {
        this.importantActive = true
        this.$refs.left.mainClick(this.missionList[0], 0, true)
      }
    },
    // 右边信息
    // rightInformation(item) {
    //   this.rightObj = item
    // },
    mainClick(item, index, is) { // 点击主任务事件
      // debugger
      if (is) { // 是否保存意见
        this.saveChangeAxios()
      }
      this.$http.post('/serviceAction/common', {
        'serviceName': 'MT01107',
        'methodName': 'getQuarterDetailSummary',
        'detailId': item.detailId,
        'targetId': item.targetId,
        'quarterNumber': this.quarterNumber
      }).then((res) => {
        if (res.isSuccess) {
          // this.$emit('rightInformation', res.data)
          this.rightObj = res.data
          this.$refs.left.scrollTop()
        }
      })
    },
    saveChangeAxios(callBack, is) { // 保存跟踪
      this.loadingState(true)
      const upInformation = this.getPrintData()
      this.$http.post('/serviceAction/common', {
        'serviceName': 'MT01107',
        'methodName': 'saveQuarterApprove',
        'summaryId': upInformation.summaryId,
        'quarterApproveContent': upInformation.quarterApproveContent
      }).then((res) => {
        if (res.isSuccess) {
          callBack && callBack()
          if (!is) {
            this.loadingState(false)
          }
        }
      })
    },
    feedback() { // 反馈持表人
      this.saveChangeAxios(() => {
        this.loading = true
        this.$http.post('/serviceAction/common', {
          'serviceName': 'MT01107',
          'methodName': 'passQuarterSummary',
          'reportId': this.reportId,
          'quarterNumber': this.quarterNumber
        }).then((res) => {
          if (res.isSuccess) {
            // console.log(res)
            // this.init()
            this.$router.push({
              path: '/auditSeeQuarter',
              query: {
                quarterNumber: this.quarterNumber,
                reportId: this.reportId,
                option: '1'
              }
            })
          }
        })
      }, true)
    },
    readAll() {
      console.log(this.reportId)
      this.loading = true
      this.$http.post('/serviceAction/common', {
        'serviceName': 'MT01107',
        'methodName': 'readAll',
        'reportId': this.reportId,
        'quarterNumber': this.quarterNumber
      }).then((res) => {
        if (res.isSuccess) {
          console.log(res)
          this.init()
        }
      })
    }

  }
}
</script>

